package com.application.outdoor.adapter;

import java.io.File;

import com.application.Activity.R;
import com.application.Controller.ReadWriteFileController;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class AvatarEntity {
	private String user;
	private Bitmap bmAvatar;

	public AvatarEntity(String user, Context context) {
		this.user = user;
		File dir = context.getDir("avatar", Context.MODE_PRIVATE);
		String path = dir.getAbsolutePath();
		if (ReadWriteFileController.isFile(path + "/" + user + ".png")) {
			bmAvatar = Bitmap.createScaledBitmap(BitmapFactory.decodeFile(path + "/" + user + ".png"), 50, 50, true);
		} else {
			bmAvatar = Bitmap.createScaledBitmap(
					BitmapFactory.decodeResource(context.getResources(), R.drawable.img_user), 50, 50, true);

		}

	}

	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		this.user = user;
	}

	public Bitmap getBmAvatar() {
		return bmAvatar;
	}

	public void setBmAvatar(Bitmap bmAvatar) {
		this.bmAvatar = bmAvatar;
	}

}
